import React, {Component, Fragment} from 'react';
import {BrowserRouter, Switch, Route} from 'react-router-dom';
import {Provider} from 'react-redux';
import store from "../store";
import Main from 'containers/Main';
import Login from 'containers/Login';
import Test from 'views/Test';
import HigherComponent from 'views/HigherComponent';
import ReduxTest from 'views/ReduxTest';
import PromiseTest from "views/PromiseTest";

class Routes extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <Fragment>
                <Provider store={store}>
                    <BrowserRouter>
                        <Switch>
                            <Route path="/login" component={Login}/>
                            <Route path="/main" component={props => (
                                <Main {...props}>
                                    <Route path="/main/test" component={Test}/>
                                    <Route path="/main/higherComponent" component={HigherComponent}/>
                                    <Route path="/main/redux" component={ReduxTest}/>
                                    <Route path="/main/promise" component={PromiseTest}/>
                                </Main>
                            )}>
                            </Route>
                        </Switch>
                    </BrowserRouter>
                </Provider>
            </Fragment>
        );
    }
}
export default Routes;